package com.hao.springboot02web;

import com.hao.springboot02web.dao.EmployeeDao;
import com.hao.springboot02web.pojo.Employee;
import org.junit.jupiter.api.Test;

import java.util.Scanner;

public class testEmployee {

    EmployeeDao employeeDao = new EmployeeDao();
    //获取员工的所有信息
    @Test
    public void getAllEmployees(){
        for (Employee employee : employeeDao.getAllEmployee()) {
            System.out.println(employee);
        }
    }

    @Test
    public void deleteEmployeeById(){
        employeeDao.deleteEmployeeById(1005);
    }
    //通过id获取员工信息
    public static void main(String[] args) {
        EmployeeDao employeeDao = new EmployeeDao();
        String msg= null;
        Scanner scanner = new Scanner(System.in);
        int id = Integer.parseInt(scanner.next());
        Employee employeeById = employeeDao.getEmployeeById(id);
        if (employeeById!=null){
            System.out.println(employeeById);
        }else {
            System.err.println("输入的id("+id+")有误！");
        }
        scanner.close();
    }
}
